import { notification } from 'antd';

const defaultValue = {
  description: '', // 默认无描述
  duration: 2, // 默认2S后关闭
  placement: 'bottomRight' // 默认右下角弹出
};

const Notification = {
  success: (config: any = {}) => {
    return notification.success({
      message: '操作成功',
      ...defaultValue,
      ...config
    });
  },
  info: (config: any = {}) => {
    return notification.info({
      message: '提示信息',
      ...defaultValue,
      ...config
    });
  },
  warning: (config: any = {}) => {
    return notification.warning({
      message: '操作异常',
      ...defaultValue,
      ...config
    });
  },
  error: (config: any = {}) => {
    return notification.error({
      message: '操作失败',
      ...defaultValue,
      ...config
    });
  }
};

export default Notification;
